<template>
    <div class="box">
    <div v-show="info.head_pic">
        <img :src="info.head_pic">
    </div>
      <div v-show="info.resource">
        <audio :src="info.resource" controls></audio>
      </div>
      <div  v-show="info.video">
        <video :src="info.video" controls></video>
      </div>
      <div class="content">
        <img v-for="(v,k) in info.images" :key="k" :src="v">
      </div>
    </div>
</template>

<script>
import * as user from '../api/user'
export default {
  name: 'myjiaocaidetail',
  data: function () {
    return {
      isPlaying: false,
      textbook_id: 0, // 教材id
      id: 0, // 目录id
      info: {}
    }
  },
  mounted () {
    this.textbook_id = this.$route.query.textbook_id
    this.id = this.$route.query.id
    this.getTextbookCalalog(this.id)
  },
  methods: {
    getTextbookCalalog: function (id) {
      user.getJiaocaiCatalog(id)
        .then(res => {
          res.data.images = res.data.content.split(',')
          this.info = res.data
        })
    }
  }
}
</script>

<style scoped>
.con{
  padding-bottom: 1.5rem;
}
.title{
  height: .9rem;
  line-height: .9rem;
  background: #f5f5f5;
  padding: 0 .3rem;
}
.title h3{
  font-size: .44rem;
  color: #555;
  position: relative;
  padding-left: .3rem;
}
.title h3:before{
  content: '';
  position: absolute;
  top: 15%;
  left: 0;
  border-left: 2px solid #ddd;
  height: 70%;
}
.teacher{
  padding: .4rem .3rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.teacher img{
  display: block;
  width: 2.2rem;
  margin-right: .3rem;
}
.teacher div{
  flex-grow: 1;
}
.teacher div h3{
  font-size: .44rem;
  color: #555;
  margin-bottom: .3rem;
}
.teacher div p{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: .4rem;
}
.info{
  padding: .4rem .3rem;
}
.info .price{
  font-size: .36rem;
}
.info .price span{
  font-size: .48rem;
  color: #f00;
}
.sm{
  margin-top: .3rem;
  margin-bottom: .3rem;
}
.sm div{
  margin-bottom: .3rem;
}
.sm h3{
  font-size: .38rem;
  color: #333;
}
.sm h3 span{
  color: blue;
}
.sm p{
  margin-top: .14rem;
  line-height: .58rem;
  font-size: .36rem;
}
.sm h2{
  margin-top: .4rem;
  text-align: center;
  font-size: .4rem;
  color: #333;
  margin-bottom: .2rem;
  font-weight: bold;
}
.fixbox{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.2rem;
  background: #f5f5f5;
  line-height: 1.2rem;
  text-align: center;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.fixbox h3{
  font-size: .4rem;
  padding-right: .5rem;
}
.buybox{
  width: 3rem;
  text-align: center;
  font-size: .5rem;
  display: inline-block;
  background: #0959c8;
  color: #fff;
}
.buybox a{
  display: block;
  color: #fff;
}
.sharebox{
  float: right;
  line-height: 1.2rem;
}
.sharebox svg{
  margin-top: .2rem;
  margin-right: .3rem;
}
.citem{
  height: 1rem;
  line-height: 1rem;
  border-bottom: 1px solid #ddd;
  padding: 0 .3rem;
  color: #333;
  font-size: .4rem;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
</style>
